/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package queenb.web.store;

import java.sql.SQLException;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import oracle.jdbc.OracleTypes;
import queenb.net.datacontrol.DataStatement;
import queenb.net.datacontrol.Param;
import queenb.net.entitybean.N250;
import queenb.net.entitybean.N450;
import queenb.web.util.PackageContants;

/**
 *
 * @author Nguyen Hung
 */
public class N250Store extends N250 {
    
    public int updateN250(int pnPN250, String pvNV251, String pvNV252, String pvNV253, int pnFH000, int pnFH200, String pvLOGIN) {
        try {
            DataStatement updateStatement = new DataStatement(PackageContants.UPDATE_N250, OracleTypes.INTEGER, new Param[]{
                        new Param(OracleTypes.INTEGER, pnPN250),
                        new Param(OracleTypes.CHAR, pvNV251),
                        new Param(OracleTypes.CHAR, pvNV252),
                        new Param(OracleTypes.CHAR, pvNV253),
                        new Param(OracleTypes.INTEGER, pnFH000),
                        new Param(OracleTypes.INTEGER, pnFH200),
                        new Param(OracleTypes.CHAR, pvLOGIN)});
            return super.update(updateStatement, N250.class);
        } catch (SQLException ex) {
            Logger.getLogger(N250Store.class.getName()).log(Level.SEVERE, null, ex);
            return 0;
        }

    }

    public List<N250> getListN250(int pnFH000, int pnFH200, String pvLOGIN) throws SQLException, InstantiationException, IllegalAccessException {
        DataStatement dataStatement = new DataStatement(PackageContants.LIST_N250, OracleTypes.CURSOR, new Param[]{
                    new Param(OracleTypes.INTEGER, pnFH000),
                    new Param(OracleTypes.INTEGER, pnFH200),
                    new Param(OracleTypes.CHAR, pvLOGIN)
                });
        return super.find(dataStatement, N250.class);
    }
    
    public List<N250> getListCombN250(int pnFH000, int pnFH200S, String pvLOGIN) {
        try {
            DataStatement dataStatement = new DataStatement(PackageContants.LIST_COMBN250, OracleTypes.CURSOR, new Param[]{
                                                             new Param(OracleTypes.INTEGER, pnFH000),
                                                              new Param(OracleTypes.INTEGER, pnFH200S),
                                                             new Param(OracleTypes.CHAR, pvLOGIN)
             });
             return super.find(dataStatement, N250.class);
        } catch (SQLException ex) {
            Logger.getLogger(N250Store.class.getName()).log(Level.SEVERE, null, ex);
            return null;
        } catch (InstantiationException ex) {
            Logger.getLogger(N250Store.class.getName()).log(Level.SEVERE, null, ex);
             return null;
        } catch (IllegalAccessException ex) {
            Logger.getLogger(N250Store.class.getName()).log(Level.SEVERE, null, ex);
             return null;
        }
    }
    
    public int deleteN250(int pnPN250, String pvLOGIN) {
        try {
            DataStatement dataStatement = new DataStatement(PackageContants.DELETE_N250, OracleTypes.INTEGER, new Param[]{
                        new Param(OracleTypes.INTEGER, pnPN250),
                        new Param(OracleTypes.CHAR, pvLOGIN)
                    });
            return super.update(dataStatement, N250.class);
        } catch (SQLException ex) {
            Logger.getLogger(N250Store.class.getName()).log(Level.SEVERE, null, ex);
            return 0;
        }

    }
}
